package cn.edu.lingnan.servlet;

import cn.edu.lingnan.pojo.User;
import cn.edu.lingnan.service.userservice;
import cn.edu.lingnan.service.userserviceimp;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


public class EchoServlet extends HttpServlet {
    userservice us=new userserviceimp();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       Integer id = Integer.parseInt(req.getParameter("id"));
        User user = us.getById(id);
        System.out.println(user);
        req.getServletContext().setAttribute("user", user);
       req.getRequestDispatcher("/update.jsp").forward(req, resp);
    }
}
